import { request } from "./index"
export default {
  getlist(data) {
    return request({
      url: "getlist",
      data,
      method: "post"
    })
  },
  getinfo(data) {
    console.log(data)
    return request({
      url: "info",
      data,
      method: "post"

    })
  },
  getparams(name) {
    var str = window.location.href;
    var returnStr;
    var array = str.split('?');
    var data = array[1];
    var Params = data.split('&');
    Params.forEach(val => {
      var list = val.split('=');
      if (name == list[0]) {
        returnStr = list[1]
      }
    })
    return returnStr
  },
  getParam(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    var r = window.location.search.substr(1).match(reg);  // 获取url中"?"符后的字符串并正则匹配
    var context = "";
    if (r != null)
      context = r[2];
    reg = null;
    r = null;
    return context == null || context == "" || context == "undefined" ? "" : context;
  }
}
